package com.xxgc.mybatis.controller;

import com.xxgc.mybatis.service.UserService;
import com.xxgc.mybatis.service.impl.UserServiceImpl;
import com.xxgc.mybatis.vo.RespBean;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;

@WebServlet("/chick")
public class ChickUserTimeController extends HttpServlet {
    private UserService userService = new UserServiceImpl();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        JSONObject jsonObject = new JSONObject();
        try {
            RespBean respBean = userService.chickUserTime();
            jsonObject.put("data",respBean);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        resp.getWriter().write(jsonObject.toString());
    }
}
